#ifndef ACCOUNT_H
#define ACCOUNT_H

// Libraries
#include "state.h"
#include "singleton.h"

// Classes
class AccountState : public CState, public Singleton<AccountState> 
{
	public:
		enum StateType 
		{
			STATE_MAIN,
			STATE_LOGIN,
		};

		enum ElementType 
		{
			ELEMENT_ACCOUNT,
			ELEMENT_PASSWORD,
			ELEMENT_LOGIN,
			ELEMENT_CANCEL,
			ELEMENT_CREATEACCOUNT,
		};

		bool Show();
		bool Hide();
		
		void HandleDisconnect(ENetEvent *TEvent);
		void HandlePacket(ENetEvent *TEvent);
		bool HandleKeyPress(EKEY_CODE TKey);
		void HandleGUI(EGUI_EVENT_TYPE TEventType, IGUIElement *TElement);

		void Update(u32 TDeltaTime);
		void Draw();

		void SetLoginInfo(const stringc &TAccountName, const stringc &TPassword);

	private:

		void ChangeState(int TState);
		bool ValidateForm();

		// States
		int State;

		// GUI
		IGUITab *Form;
		IGUIStaticText *TextAccountName, *TextPassword;
		IGUIEditBox *EditAccountName, *EditPassword;
		IGUIButton *ButtonLogin, *ButtonCancel, *ButtonCreateAccount;
		stringc Message, AccountName, Password;
		bool CreateAccount;
		
};

#endif
